#pragma once

#include "RenderSystem.h"

#include "Game.h"
#include "GameBoard.h"
#include "MarkerEnvironment.h"

namespace TUMAR { namespace CountryRoads {

	class GameBoardRenderer : public TUMAR::Render::AbstractRenderer
	{
	private:
		std::map<TileType, GLuint> textures;

		const Game* game;
		const GameBoard* board;
		const MarkerEnvironment* marker;
		float alpha;
		float beta;
		bool direction;

		void DrawTile(TileType type, bool color = true);
		void DrawUserTiles(void);
		void DrawOutOfBorderMarkers(void);
		void DrawBorder(void);
		void DrawHorse(void);
		void DrawObstacleHayBail(void);
		void DrawObstacleStone(void);
		void DrawCowboy(void);
		void DrawObstacleTreeRoots(void);
		void DrawObstacleTreeTrunk(bool upright=true);
		void DrawBomb(void);
		void DrawTrophy(void);

		void DrawCoordFrame(void);
		void DrawCharacter(void);
		
		void SetColor(TileType type);
		GLenum GetVertexType(TileType type);
	public:
		GameBoardRenderer(void);
		virtual ~GameBoardRenderer(void);
	
		virtual void Init(void);
		virtual void Resize(int width, int height);
		virtual void Render(void);

		void OnGameUpdated(const Game* game, const GameBoard* board, const MarkerEnvironment* marker);
	};

}}